package lab03.test04;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test {
    public static void main(String[] args) {

        String file1="D:\\sourse/High.mp3";
        String file2="D:\\target";

        //字节流读文件
        FileInputStream file1InputStream=null;

        //字节流写文件
        FileOutputStream file2OutputStream=null;

        try {
            file1InputStream=new FileInputStream(file1);

            file2OutputStream=new FileOutputStream(file2);

            int data;

            while((data=file1InputStream.read())!=-1){

                file2OutputStream.write(data);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {

            try {
                file1InputStream.close();
                file2OutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
